import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Test1 {

    public int maxArea(int[] height) {
        int n=height.length;
        int left=0;
        int right=n-1;
        int volume=0;
       // int[] ints=new int[]{1,2,3,4,5};
        while (left<right){
            int tall=height[left]>=height[right]?height[right]:height[left];
            int newV=(right-left)*tall;
            volume=newV>=volume?newV:volume;
            if(tall==height[left]){
                left++;
            }
            else {
                right--;
            }
        }
        return volume ;
    }

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n= scanner.nextInt();
        int target1=-11;
        int[] nums=new int[n];
        List<List<Integer>> arrayList=new ArrayList<>();
        for(int i=0;i<n;i++){
            nums[i]=scanner.nextInt();
        }
        Arrays.sort(nums);
        for(int k=0;k<=n-4;) {
            for (int i = k+1; i <= n - 3; ) {
                int left = i + 1;
                int right = n - 1;
                int target = target1 -nums[k]- nums[i];

                while (left < right) {
                    int sum = nums[left] + nums[right];
                    if (sum == target) {
                        List<Integer> arrayList1 = new ArrayList<>();
                        arrayList1.add(nums[k]);
                        arrayList1.add(nums[i]);
                        arrayList1.add(nums[left]);
                        arrayList1.add(nums[right]);
                        arrayList.add(arrayList1);
                        right--;
                        left++;
                        while (nums[right] == nums[right + 1] && right > left)
                            right--;
                        while (nums[left] == nums[left - 1] && left < right)
                            left++;
                    } else if (sum > target) right--;
                    else left++;
                }
                i++;
                while (nums[i] == nums[i - 1] && i < n - 1) {
                    i++;
                }
                if (i > n - 3) break;
            }
            k++;
            while (nums[k] == nums[k - 1] && k < n - 1) {
                k++;
            }
            if (k > n - 3) break;
        }
        for(int i=0;i< arrayList.size();i++)
            System.out.println(arrayList.get(i).toString());
    }
    public static void main4(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n= scanner.nextInt();
        int[] nums=new int[n];
        List<List<Integer>> arrayList=new ArrayList<>();
        for(int i=0;i<n;i++){
            nums[i]=scanner.nextInt();
        }
        Arrays.sort(nums);
        for(int i=0;i<=n-3;){
            if(nums[i]>0) break;
            int left=i+1;
            int right=n-1;
            int target=0-nums[i];

            while (left<right){
                int sum=nums[left]+nums[right];
                if(sum==target){
                    List<Integer> arrayList1=new ArrayList<>();
                    arrayList1.add(nums[i]);
                    arrayList1.add(nums[left]);
                    arrayList1.add(nums[right]);
                        arrayList.add(arrayList1);
                        right--;
                        left++;
                        while (nums[right]==nums[right+1]&&right>left)
                            right--;
                        while (nums[left]==nums[left-1]&&left<right)
                            left++;
                }
                else if (sum>target) right--;
                else left++;
            }
            i++;
            while (nums[i]==nums[i-1]&&i<n-1)  {
                i++;
            }
            if(i>n-3) break;
        }
        for(int i=0;i< arrayList.size();i++)
        System.out.println(arrayList.get(i).toString());
        //-4 -4 -1 0 0 1 1 4 4 5 6
    }

    public static void main3(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n= scanner.nextInt();
        int target= scanner.nextInt();
        int[] nums=new int[n];
        for(int i=0;i<n;i++){
            nums[i]=scanner.nextInt();
        }
        Arrays.sort(nums);
        int left=0;
        int right=n-1;
        while (left<right){
           int  sum=nums[right]+ nums[left];
            if(sum>target) right--;
            else if (sum<target) left++;
            else{
                System.out.println("["+nums[left]+","+nums[right]+"]");
                return;
            }
        }
        System.out.println("null");
    }

    public static void main2(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n= scanner.nextInt();
        int[] nums=new int[n];
        for(int i=0;i<n;i++){
            nums[i]=scanner.nextInt();
        }
        Arrays.sort(nums);
        int sum=0;
        if(nums.length<=2) {
            System.out.println(-1);
            return;
        }
        for(int i=n-1;i>=2;i--){
            int left=0;
            int right=i-1;
            while (left!=right){
                if(nums[left]+nums[right]>nums[i]) {
                    sum += right - left;
                    right--;
                }
                else {
                    left++;
                }
            }

        }
        System.out.println(sum);
    }
    public static void main1(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n= scanner.nextInt();
        int[] height=new int[n];
        for(int i=0;i<n;i++){
            height[i]=scanner.nextInt();
        }
        int left=0;
        int right=n-1;
        int volume=0;
        while (left<right){
            int tall=height[left]>=height[right]?height[right]:height[left];
            int newV=(right-left)*tall;
            volume=newV>=volume?newV:volume;
            if(tall==height[left]){
                left++;
            }
            else {
                right--;
            }
        }
        System.out.println(volume);
    }
}
